"""
    将assert断言的三句代码所比较的字典内容优化为一句
    assert r.json()['status'] == register_data['expect']['status']
    assert r.json()['code'] == register_data['expect']['code']
    assert r.json()['msg'] == register_data['expect']['msg']
    ====
    check_equal(r.json(),register_data['except'],['status','code','msg'])
    使用pytest_check 第三方库，专门用来做断言
    pip install pytest-check
"""


import pytest_check as c

def check_equal(real,expect,keys):
    for key in keys:
        r = real[key]
        e = expect[key]

        if c.equal(r,e):
            print(f"校验{key}成功")
        else:
            print(f"校验{key}失败,实际结果为{e}")